 $(document).ready(function(){
	$("#grs button, #grs .button").button();
	
	$("#grs .dialog").dialog({
        autoOpen: false, 
        modal: true,
        buttons: { 
            "Cancel": function() { $(this).dialog("close"); } 
        } 
    }); 
    
    showGames();	
});
 
 
function showGames(){
	//$('.grs-intro').hide('fast');
	
	$.post('tables.php', {show: 'games'}, function(data) {
        $('.list_game').html(data);
        
        $('#games').fadeIn('fast');
    });
}
    
function showModes(g_id){

	$.post('tables.php', {
		show: 'modes',
        game_id: g_id
        
    }, function(data) {
		$('.list_mode').html(data);
		
		$('#modes').fadeIn('fast');
	});
}

function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}

function appendOptionLast(select, value, text){
    select.disabled=false;
    select.options[select.options.length] = new Option(text,value);
}

function clearSelect(select){
    select.disabled=true;
    for (i = select.options.length; i >= 0; --i) {
		select.options[i] = null;
	}
}

	